#ifndef __APP_VIEW_H__
#define __APP_VIEW_H__

#include "./view.h"

namespace MiniUI
{

class WinView;
typedef void (Delegater::*OnWindowActivateEventFunc)(const WinView* sender, bool bActivate);

class Container;
class HoverTrigger;
class WinView : public DeriveUIObject<WinView, View>
{
public:
    friend class DeriveUIObject<WinView, View>;
protected:
    WinView();
    ~WinView();
public:
    //Win Opertaion
    void OpenWindow(const Type::MiniRect& rcWnd);
    void GetScreenCursorPos(Type::MiniPoint& pt);
    void* GetHost();
    void SetCursor(CursorType cursor, void* customCursor);
    void SetWinBorder(const Type::MiniRect& rcBorder);
    bool SetFocusObject(UIObject* pObj);
	UIObject* GetFocusObject();
    void DoWindowActivate(bool bActivate);
	//View Operation Override
    bool AddChild(UIObject* pChild);
    int InsertChild(int nPos, UIObject* pChild);
    //App Singlton Object
    HoverTrigger* GetHoverTrigger();
private:
    void FakeUpdateRect(const Type::MiniRect& rcWnd);
public:
    Event<OnWindowActivateEventFunc> OnWindowActivate;
private:
    Container* m_pContainer;
    HoverTrigger* m_pHoverTrigger;
	UIObject* m_pObjFocus;
};

}

#endif